Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

[Console] filter doctrine log with -vv cli option #707

Merged
merged 1 commit into from
Sep 22, 2014

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Sep 3, 2014

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets none
License MIT
Doc PR none

I add this configuration to all my projects. So I think it could be the default
behavior fore everyone.

Why?

When you write commands and you use lot of log in your application with the
debug log level; you have to use -vvv option to see them. But with
`-vvv``option, doctrine log is also output. This is a bit annoying because it
becomes very hard to filter your log from doctrine log.

How?

So with this patch you get all logs with debug or higher log level, except
doctrine log with vv option. And you get all logs with -vvv option. With
only -v option, you get only info or higher log level.

@fabpot
Copy link
Member

fabpot commented Sep 4, 2014

I agree that getting SQL on the console in very annoying... Do we really need them? I mean even with -vvv?

@lyrixx
Copy link
Member Author

lyrixx commented Sep 4, 2014

Yes, sometime, I need them, but it's rare.

@fabpot
Copy link
Member

fabpot commented Sep 22, 2014

Thank you @lyrixx.

@fabpot fabpot merged commit 138065d into symfony:master Sep 22, 2014
fabpot added a commit that referenced this pull request Sep 22, 2014
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Console] filter doctrine log with -vv cli option

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

I add this configuration to all my projects. So I think it could be the default
behavior fore everyone.

Why?

When you write commands and you use lot of log in your application with the
`debug` log level; you have to use `-vvv` option to see them. But with
`-vvv``option, doctrine log is also output. This is a bit annoying because it
becomes very hard to filter your log from doctrine log.

How?

So with this patch you get all logs with `debug` or higher log level, except
doctrine log with `vv` option. And you get all logs with `-vvv` option. With
only `-v` option, you get only `info` or higher log level.

Commits
-------

138065d [Console] filter doctrine log with -vv cli option
@lyrixx lyrixx deleted the console-log-tweak branch September 22, 2014 14:23
fabpot added a commit that referenced this pull request Dec 18, 2015
This PR was merged into the 2.7 branch.

Discussion
----------

ignore event and doctrine logs in console

Follow up on #908 to also ignore event logs in console. And simplify #707 to just ignore doctrine logs as well. #707 was not good because it creates inconsistencies between prod and dev environment. I.e. `-vv` has different result in prod and dev environment because the verbosity_level map is different which is really unexpected if you want to process stderr log in prod environment but they are not there.

So this gets rid these messages when running `app/console -vvv`

```
[2015-12-15 16:40:04] event.DEBUG: Notified event "console.command" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure". [] []
[2015-12-15 16:40:04] event.DEBUG: Notified event "console.command" to listener "Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand". [] []
```

Commits
-------

827ec90 ignore event and doctrine logs in console
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants